<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>切换图片的显示和隐藏</title>
<script src="../JS/vue.js"></script>
</head>
<body>
<div id="box">
	<input type="button" :value="bText" v-on:click="toggle">
	<div v-show="show">
		<img src="face.png">
	</div>
</div>
<script type="text/javascript">
    var demo = new Vue({
        el : '#box',
        data : {
			bText : '隐藏图片',
			show : true
		},
		methods : {
			toggle : function(){
				//切换按钮文字
				this.bText == '隐藏图片' ? this.bText = '显示图片' : this.bText = '隐藏图片';
				this.show = !this.show;//修改属性值
			}
		}
    });
</script>
</body>
</html>